package com.fary.controller;

import com.fary.entity.User;
import org.springframework.web.bind.annotation.*;

@RestController
public class UserController {

    @GetMapping("/user/hello")
    public String hello() {
        return "hello";
    }

    @GetMapping("/user/data")
    public User getUser(@RequestParam("name") String name) {
        return new User("fangyuan", "18");
    }

    @GetMapping("/user/data/{name}")
    public String getUserName(@PathVariable("name") String name) {
        return name;
    }

    @PostMapping("/user/data")
    public User updateUser(@RequestBody User user) {
        return user;
    }
}